﻿using System.Collections.Generic;
using System.Linq;
using Citi.HeadCount.Domain;

namespace Citi.HeadCount.WebUI.Models
{
    public class RuleResultViewModel
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public IEnumerable<TypeRuleResultViewModel> TypeRuleResults { get; set; }
        public IEnumerable<RuleViewModel> Rules { get; set; }

        public static RuleResultViewModel CreateViewModel(RuleResult domain)
        {
            return new RuleResultViewModel {Id = domain.Id, 
                Rules = RuleViewModel.CreateModel(domain.Rules), 
                TypeRuleResults = TypeRuleResultViewModel.CreateModel(domain.TypeRuleResults)};
        }

        public static IEnumerable<RuleResultViewModel> CreateViewModel(IEnumerable<RuleResult> domain)
        {
            return domain.Select(CreateViewModel);
        }
    }
}